This paper is a ``Habilitationsschrift'', a second thesis required until recently by universities in Germany and in a few other countries to obtain the right to lecture. It was accepted by the University of Goettingen in 1990 after review by a number of german and international experts. Although the introduction and the references represent the state of research in 1990, most of the remaining content is still relevant and has never been published elsewhere. The most important part is the derivation of a linear stability formalism for thin magnetic flux tubes following an arbitrary path in a gravitationally stratified medium with a stationary velocity. It was found later (Ferriz-Mas & Schuessler, Geophys. Astrophys. Fluid Dyn. vol. 72, 209; 1995) that, for consistency, the inertial term in the equation of motion for the external medium should be included in Eq. (3.24), which leads to an additional term in the stability equations in the case of a spatially varying external velocity. This term is missing in the present text, but can be easily introduced into the formalism. The full abstract can be found at the beginning of the paper.